;; supercollider/input.scm - (c) rohan drape, 2003-2005

;; An <input> represents a UGen input signal in a UGen graph, an
;; 'Input Specification'.  The <integer> ugen is the index of the UGen
;; to read from, the <integer> port is the output port at ugen to read
;; from.  The binary representation is a sequence of two signed two
;; byte network order integers.

(define-structure input (ugen port))

(define (input-read port)
  (make-input (read-int16 port)
	      (read-int16 port)))

(define (input-write s port)
  (write-int16 (input-ugen s) port)
  (write-int16 (input-port s) port))

(define (input-encode s)
  (u8vector-append (encode-int16 (input-ugen s))
		   (encode-int16 (input-port s))))
